package com.zjgeport.zjgdanger.common;

import com.zjgeport.zjgdanger.Charts.components.AxisBase;
import com.zjgeport.zjgdanger.Charts.formatter.IAxisValueFormatter;

import java.util.HashMap;
import java.util.List;

public class ContainerXAisFormatter implements IAxisValueFormatter {

    private List<HashMap<String, String>> dataMap;

    public ContainerXAisFormatter(List<HashMap<String, String>> data) {
        // maybe do something here or provide parameters in constructor
        this.dataMap = data;

    }

    @Override
    public String getFormattedValue(float value, AxisBase axis) {

        float percent = value / (axis.mAxisRange*10/9.1f);
        HashMap<String,String> map = this.dataMap.get((int) (this.dataMap.size() * percent));
        return map.get("TYP_NAM").toString();
    }
}
